<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  
  <title>asp.net中的url重写 | haijd</title>
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  
  <meta name="keywords" content="ASP.NET转载" />
  
  
  
  
  <meta name="description" content="ASP.NET中的Url重写">
<meta name="keywords" content="ASP.NET,转载">
<meta property="og:type" content="article">
<meta property="og:title" content="ASP.NET中的Url重写">
<meta property="og:url" content="http://www.hais2.com/2015/02/11/ASP-NET-Url-Rewriting/index.html">
<meta property="og:site_name" content="haijd">
<meta property="og:description" content="ASP.NET中的Url重写">
<meta property="og:locale" content="default">
<meta property="og:image" content="http://ww1.sinaimg.cn/mw690/c55a7aeejw1f1hc5019pej20it0buwhk.jpg">
<meta property="og:updated_time" content="2017-08-02T15:22:33.000Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="ASP.NET中的Url重写">
<meta name="twitter:description" content="ASP.NET中的Url重写">
<meta name="twitter:image" content="http://ww1.sinaimg.cn/mw690/c55a7aeejw1f1hc5019pej20it0buwhk.jpg">
  
    <link rel="alternate" href="/atom.xml" title="haijd" type="application/atom+xml">
  
  <link rel="icon" href="/css/images/favicon.ico">
  
    <link href="//fonts.googleapis.com/css?family=Source+Code+Pro" rel="stylesheet" type="text/css">
  
  <link href="https://fonts.googleapis.com/css?family=Open+Sans|Montserrat:700" rel="stylesheet" type="text/css">
  <link href="https://fonts.googleapis.com/css?family=Roboto:400,300,300italic,400italic" rel="stylesheet" type="text/css">
  <link href="//cdn.bootcss.com/font-awesome/4.6.3/css/font-awesome.min.css" rel="stylesheet">
  <style type="text/css">
    @font-face{font-family:futura-pt;src:url(https://use.typekit.net/af/9749f0/00000000000000000001008f/27/l?subset_id=2&fvd=n5) format("woff2");font-weight:500;font-style:normal;}
    @font-face{font-family:futura-pt;src:url(https://use.typekit.net/af/90cf9f/000000000000000000010091/27/l?subset_id=2&fvd=n7) format("woff2");font-weight:500;font-style:normal;}
    @font-face{font-family:futura-pt;src:url(https://use.typekit.net/af/8a5494/000000000000000000013365/27/l?subset_id=2&fvd=n4) format("woff2");font-weight:lighter;font-style:normal;}
    @font-face{font-family:futura-pt;src:url(https://use.typekit.net/af/d337d8/000000000000000000010095/27/l?subset_id=2&fvd=i4) format("woff2");font-weight:400;font-style:italic;}</style>
    
  <link rel="stylesheet" id="athemes-headings-fonts-css" href="//fonts.googleapis.com/css?family=Yanone+Kaffeesatz%3A200%2C300%2C400%2C700&amp;ver=4.6.1" type="text/css" media="all">
  <link rel="stylesheet" href="/css/style.css">

  <script src="/js/jquery-3.1.1.min.js"></script>

  <!-- Bootstrap core CSS -->
  <link rel="stylesheet" href="/css/bootstrap.css" >
  <link rel="stylesheet" href="/css/hiero.css" >
  <link rel="stylesheet" href="/css/glyphs.css" >
  
    <link rel="stylesheet" href="/css/vdonate.css" >
  

</head>

<script>
var themeMenus = {};

  themeMenus["/"] = "Home"; 

  themeMenus["/archives"] = "Archives"; 

  themeMenus["/categories"] = "Categories"; 

  themeMenus["/tags"] = "Tags"; 

  themeMenus["/about"] = "About"; 

</script>


  <body data-spy="scroll" data-target="#toc" data-offset="50">


  <header id="allheader" class="site-header" role="banner">
  <div class="clearfix container">
      <div class="site-branding">

          <h1 class="site-title">
            
              <a href="/" title="haijd" rel="home"> haijd </a>
            
          </h1>

          
            <div class="site-description">Stay Hungry,Stay Foolish</div>
          
            
          <nav id="main-navigation" class="main-navigation" role="navigation">
            <a class="nav-open">Menu</a>
            <a class="nav-close">Close</a>
            <div class="clearfix sf-menu">

              <ul id="main-nav" class="nmenu sf-js-enabled">
                    
                      <li class="menu-item menu-item-type-custom menu-item-object-custom menu-item-home menu-item-1663"> <a class="" href="/">Home</a> </li>
                    
                      <li class="menu-item menu-item-type-custom menu-item-object-custom menu-item-home menu-item-1663"> <a class="" href="/archives">Archives</a> </li>
                    
                      <li class="menu-item menu-item-type-custom menu-item-object-custom menu-item-home menu-item-1663"> <a class="" href="/categories">Categories</a> </li>
                    
                      <li class="menu-item menu-item-type-custom menu-item-object-custom menu-item-home menu-item-1663"> <a class="" href="/tags">Tags</a> </li>
                    
                      <li class="menu-item menu-item-type-custom menu-item-object-custom menu-item-home menu-item-1663"> <a class="" href="/about">About</a> </li>
                    
              </ul>
            </div>
          </nav>


      </div>
  </div>
</header>




  <div id="container">
    <div id="wrap">
            
      <div id="content" class="outer">
        
          <section id="main" style="float:none;"><article id="post-ASP-NET-Url-Rewriting" style="width: 66%; float:left;" class="article article-type-post" itemscope itemprop="blogPost" >
  <div id="articleInner" class="clearfix post-1016 post type-post status-publish format-standard has-post-thumbnail hentry category-template-2 category-uncategorized tag-codex tag-edge-case tag-featured-image tag-image tag-template">
    
    
      <header class="article-header">
        
  
    <h1 class="thumb" class="article-title" itemprop="name">
      ASP.NET中的Url重写
    </h1>
  

      </header>
    
    <div class="article-meta">
      
	Posted on <a href="/2015/02/11/ASP-NET-Url-Rewriting/" class="article-date">
	  <time datetime="2015-02-11T05:47:48.000Z" itemprop="datePublished">February 11, 2015</time>
	</a>

      
	<span id="busuanzi_container_page_pv">
	  本文总阅读量<span id="busuanzi_value_page_pv"></span>次
	</span>

    </div>
    <div class="article-entry" itemprop="articleBody">
      
        <h2 id="一-为了页面更有利于seo优化，url重写程序需要做出的不可缺少的手段之一。"><a href="#一-为了页面更有利于seo优化，url重写程序需要做出的不可缺少的手段之一。" class="headerlink" title="一. 为了页面更有利于seo优化，url重写程序需要做出的不可缺少的手段之一。"></a>一. 为了页面更有利于seo优化，url重写程序需要做出的不可缺少的手段之一。</h2><h2 id="二-目前url重写最常见的两种方法有："><a href="#二-目前url重写最常见的两种方法有：" class="headerlink" title="二.目前url重写最常见的两种方法有："></a>二.目前url重写最常见的两种方法有：</h2><p>　　1. 通过熟悉页面的内部执行流程，也就是asp.net请求管道中的相关知识点，进行url重写。<br>　　2. 通过使用微软提供的UrlRewriter.dll实现url重写（简单）；</p>
<h2 id="三、在请求管道中的第一个请求管道中拦截url并使其完成url重写功能："><a href="#三、在请求管道中的第一个请求管道中拦截url并使其完成url重写功能：" class="headerlink" title="三、在请求管道中的第一个请求管道中拦截url并使其完成url重写功能："></a>三、在请求管道中的第一个请求管道中拦截url并使其完成url重写功能：</h2><p>　　1. 熟悉请求管道实现程序运行的全过程：<br>　　　　(1)：BeginRequest: 开始处理请求<br>　　　　(2)：AuthenticateRequest授权验证请求，获取用户授权信息<br>　　　　(3):PostAuthenticateRequest获取成功<br>　　　　(4): AunthorizeRequest 授权，一般来检查用户是否获得权限   <a id="more"></a><br>　　　　(5):PostAuthorizeRequest:获得授权<br>　　　　(6):ResolveRequestCache:获取页面缓存结果<br>　　　　(7):PostResolveRequestCache 已获取缓存<br>　　　　(8):PostMapRequestHandler 创建页面对象<br>　　　　(9):AcquireRequestState 获取Session—–先判断当前页面对象是否实现了IRequiresSessionState接口，如果实现了，则从浏览器发来的请求报文体中获得SessionID,并到服务器的Session池中获得对应的Session对象，最后赋值给HttpContext的Session属性<br>　　　　(10)PostAcquireRequestState 获得Session<br>　　　　(11)PreRequestHandlerExecute:准备执行页面对象执行页面对象的ProcessRequest方法<br>　　　　(12)PostRequestHandlerExecute 执行完页面对象了<br>　　　　(13)ReleaseRequestState 释放请求状态<br>　　　　(14)PostReleaseRequestState 已释放请求状态<br>　　　　(15)UpdateRequestCache 更新缓存<br>　　　　(16)PostUpdateRequestCache 已更新缓存<br>　　　　(17)LogRequest 日志记录<br>　　　　(18)PostLogRequest 已完成日志<br>　　　　(19)EndRequest 完成<br><img src="http://ww1.sinaimg.cn/mw690/c55a7aeejw1f1hc5019pej20it0buwhk.jpg" alt=""><br>　　2. 直接上代码：<br><figure class="highlight cs"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">using</span> System;</span><br><span class="line"><span class="keyword">using</span> System.Collections.Generic;</span><br><span class="line"><span class="keyword">using</span> System.Web;</span><br><span class="line"><span class="keyword">using</span> System.Text;</span><br><span class="line"><span class="keyword">using</span> System.Text.RegularExpressions;</span><br><span class="line"></span><br><span class="line"><span class="keyword">namespace</span> <span class="title">UrlReWriter</span></span><br><span class="line">&#123;</span><br><span class="line">    <span class="keyword">class</span> <span class="title">UrlWriter</span>:<span class="title">IHttpModule</span></span><br><span class="line">    &#123;</span><br><span class="line">        <span class="meta">#<span class="meta-keyword">region</span> IHttpModule 成员</span></span><br><span class="line"></span><br><span class="line">     </span><br><span class="line">        <span class="function"><span class="keyword">public</span> <span class="keyword">void</span> <span class="title">Init</span>(<span class="params">HttpApplication context</span>)</span></span><br><span class="line"><span class="function">        </span>&#123;</span><br><span class="line">           context.BeginRequest+=<span class="keyword">new</span> EventHandler(context_BeginRequest);</span><br><span class="line">        &#125;</span><br><span class="line"></span><br><span class="line">        <span class="function"><span class="keyword">void</span> <span class="title">context_BeginRequest</span>(<span class="params"><span class="keyword">object</span> sender, EventArgs e</span>)</span></span><br><span class="line"><span class="function">        </span>&#123;</span><br><span class="line">            <span class="comment">//获得当前页面请求管道的HttpApplication对象</span></span><br><span class="line">            HttpApplication application = sender <span class="keyword">as</span> HttpApplication;</span><br><span class="line">            HttpContext context = application.Context;<span class="comment">//获得上下文对象</span></span><br><span class="line">            <span class="keyword">string</span> url = context.Request.Url.LocalPath;<span class="comment">//获得URL(不包含域名和路径)</span></span><br><span class="line"></span><br><span class="line">            Regex reg1 = <span class="keyword">new</span> Regex(<span class="string">"/WebForm2/[A-Z0-9a-z_]+"</span>);<span class="comment">//注意文件夹与文件名称的大小写.</span></span><br><span class="line">            <span class="keyword">if</span> (reg1.IsMatch(url)) <span class="comment">//这种情况是匹配根据ID值来查看某个文章的内容。</span></span><br><span class="line">            &#123;</span><br><span class="line">                <span class="keyword">string</span> strUserName = url.Substring(url.LastIndexOf(<span class="string">'/'</span>)+<span class="number">1</span>);</span><br><span class="line">                context.RewritePath(<span class="string">"/WebForm2.aspx?id="</span> + strUserName); <span class="comment">//前台的列表页就可以这样写:&lt;a href='../WebForm2/&lt;%#Eval("id")%&gt;'&gt;&lt;/a&gt;</span></span><br><span class="line">            &#125;</span><br><span class="line">            <span class="keyword">else</span> <span class="keyword">if</span> (url.Contains(<span class="string">"/admin"</span>))   <span class="comment">//如果url中包含"/admin"字样则转向，实现用户验证，哈哈，不过这里是错的，应为这个请求管道中还获取不到session值呢，这个验证最好在第九个请求管道（AcquireRequestState ）中完成。</span></span><br><span class="line">            &#123;</span><br><span class="line">                context.RewritePath(<span class="string">"/Error.aspx"</span>); </span><br><span class="line">            &#125;</span><br><span class="line">        &#125;</span><br><span class="line">        <span class="function"><span class="keyword">public</span> <span class="keyword">void</span> <span class="title">Dispose</span>(<span class="params"></span>)</span></span><br><span class="line"><span class="function">        </span>&#123;</span><br><span class="line">            </span><br><span class="line">        &#125;</span><br><span class="line"></span><br><span class="line">        <span class="meta">#<span class="meta-keyword">endregion</span></span></span><br><span class="line">    &#125;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure></p>
<figure class="highlight erb"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br></pre></td><td class="code"><pre><span class="line"><span class="xml"><span class="tag">&lt;<span class="name">%</span></span></span><span class="ruby">@ Page Language=<span class="string">"C#"</span> AutoEventWireup=<span class="string">"true"</span> CodeBehind=<span class="string">"WebForm1.aspx.cs"</span> Inherits=<span class="string">"url重写.WebForm1"</span> </span><span class="xml"><span class="tag">%&gt;</span></span></span><br><span class="line"><span class="xml"></span></span><br><span class="line"><span class="xml"><span class="meta">&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;</span></span></span><br><span class="line"><span class="xml"></span></span><br><span class="line"><span class="xml"><span class="tag">&lt;<span class="name">html</span> <span class="attr">xmlns</span>=<span class="string">"http://www.w3.org/1999/xhtml"</span>&gt;</span></span></span><br><span class="line"><span class="xml"><span class="tag">&lt;<span class="name">head</span> <span class="attr">runat</span>=<span class="string">"server"</span>&gt;</span></span></span><br><span class="line"><span class="xml">    <span class="tag">&lt;<span class="name">title</span>&gt;</span><span class="tag">&lt;/<span class="name">title</span>&gt;</span></span></span><br><span class="line"><span class="xml"><span class="tag">&lt;/<span class="name">head</span>&gt;</span></span></span><br><span class="line"><span class="xml"><span class="tag">&lt;<span class="name">body</span>&gt;</span></span></span><br><span class="line"><span class="xml">    <span class="tag">&lt;<span class="name">form</span> <span class="attr">id</span>=<span class="string">"form1"</span> <span class="attr">runat</span>=<span class="string">"server"</span>&gt;</span></span></span><br><span class="line"><span class="xml">    <span class="tag">&lt;<span class="name">div</span>&gt;</span></span></span><br><span class="line"><span class="xml">       <span class="tag">&lt;<span class="name">a</span> <span class="attr">href</span>=<span class="string">"WebForm2/12"</span>&gt;</span>重写<span class="tag">&lt;/<span class="name">a</span>&gt;</span>   <span class="comment">&lt;!--这里是有利于seo的链接--&gt;</span></span></span><br><span class="line"><span class="xml">    <span class="tag">&lt;/<span class="name">div</span>&gt;</span></span></span><br><span class="line"><span class="xml">    <span class="tag">&lt;/<span class="name">form</span>&gt;</span></span></span><br><span class="line"><span class="xml"><span class="tag">&lt;/<span class="name">body</span>&gt;</span></span></span><br><span class="line"><span class="xml"><span class="tag">&lt;/<span class="name">html</span>&gt;</span></span></span><br></pre></td></tr></table></figure>
<figure class="highlight cpp"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">using</span> System;</span><br><span class="line"><span class="keyword">using</span> System.Collections.Generic;</span><br><span class="line"><span class="keyword">using</span> System.Linq;</span><br><span class="line"><span class="keyword">using</span> System.Web;</span><br><span class="line"><span class="keyword">using</span> System.Web.UI;</span><br><span class="line"><span class="keyword">using</span> System.Web.UI.WebControls;</span><br><span class="line"></span><br><span class="line"><span class="keyword">namespace</span> url重写</span><br><span class="line">&#123;</span><br><span class="line">    <span class="keyword">public</span> partial <span class="class"><span class="keyword">class</span> <span class="title">WebForm2</span> :</span> System.Web.UI.Page</span><br><span class="line">    &#123;</span><br><span class="line">        <span class="function"><span class="keyword">protected</span> <span class="keyword">void</span> <span class="title">Page_Load</span><span class="params">(object sender, EventArgs e)</span></span></span><br><span class="line"><span class="function">        </span>&#123;</span><br><span class="line">            Response.Write(Request.QueryString[<span class="string">"id"</span>]);           <span class="comment">//在转到的页面输出传过来的参数</span></span><br><span class="line">        &#125;</span><br><span class="line">    &#125;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
<figure class="highlight xml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line"><span class="tag">&lt;<span class="name">httpModules</span>&gt;</span></span><br><span class="line">     <span class="tag">&lt;<span class="name">add</span> <span class="attr">name</span>=<span class="string">"UrlReWriter"</span> <span class="attr">type</span>=<span class="string">"UrlReWriter.UrlWriter,UrlReWriter"</span>/&gt;</span></span><br><span class="line">   <span class="tag">&lt;/<span class="name">httpModules</span>&gt;</span></span><br><span class="line">   <span class="tag">&lt;<span class="name">pages</span> <span class="attr">controlRenderingCompatibilityVersion</span>=<span class="string">"3.5"</span> <span class="attr">clientIDMode</span>=<span class="string">"AutoID"</span>/&gt;</span></span><br><span class="line"> <span class="tag">&lt;/<span class="name">system.web</span>&gt;</span></span><br></pre></td></tr></table></figure>
<p><strong>Note:</strong>记得在url重写项目中引用UrlReWriter项目。否则httpModules接口没有注册，url重写泡汤是必然的。</p>
<p>原文来自<a href="http://www.cnblogs.com/knowledgesea/archive/2012/10/08/2715350.html" target="_blank" rel="noopener">博客园</a><br>作者：<strong>张龙豪</strong></p>

      
    </div>
    <footer class="entry-meta entry-footer">
      
	<span class="ico-folder"></span>
    <a class="article-category-link" href="/categories/ASP-NET/">ASP.NET</a>

      
  <span class="ico-tags"></span>
  <ul class="article-tag-list"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/ASP-NET/">ASP.NET</a></li><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/转载/">转载</a></li></ul>

      
        <div id="donation_div"></div>

<script src="/js/vdonate.js"></script>
<script>
var a = new Donate({
  title: '如果觉得我的文章对您有用，请随意打赏。您的支持将鼓励我继续创作!', // 可选参数，打赏标题
  btnText: 'Donate', // 可选参数，打赏按钮文字
  el: document.getElementById('donation_div'),
  wechatImage: '/css/images/wechatPay.png',
  alipayImage: '/css/images/alipay.jpg'
});
</script>
      

      
        
	<section id="comments" class="comment">
	  <div id="disqus_thread">
	  <noscript>Please enable JavaScript to view the <a href="//disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>
	  </div>
	</section>

	<script type="text/javascript">
	var disqus_shortname = 'haijdblog';
	(function(){
	  var dsq = document.createElement('script');
	  dsq.type = 'text/javascript';
	  dsq.async = true;
	  dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js';
	  (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
	}());
	(function(){
	  var dsq = document.createElement('script');
	  dsq.type = 'text/javascript';
	  dsq.async = true;
	  dsq.src = '//' + disqus_shortname + '.disqus.com/count.js';
	  (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
	}());
	</script>


      
    </footer>
  </div>
  
    
<nav id="article-nav">
  
    <a href="/2015/03/25/Added-the-database-search-statement-summary/" id="article-nav-newer" class="article-nav-link-wrap">
      <strong class="article-nav-caption">Newer</strong>
      <div class="article-nav-title">
        
          数据库基本增删改查语句总结
        
      </div>
    </a>
  
  
    <a href="/2015/01/27/File-stream-operation-code/" id="article-nav-older" class="article-nav-link-wrap">
      <strong class="article-nav-caption">Older</strong>
      <div class="article-nav-title">文件流操作流程代码</div>
    </a>
  
</nav>

  
</article>

<!-- Table of Contents -->

  <aside id="sidebar">
    <div id="toc" class="toc-article">
    <strong class="toc-title">Contents</strong>
    
      <ol class="nav"><li class="nav-item nav-level-2"><a class="nav-link" href="#一-为了页面更有利于seo优化，url重写程序需要做出的不可缺少的手段之一。"><span class="nav-number">1.</span> <span class="nav-text">一. 为了页面更有利于seo优化，url重写程序需要做出的不可缺少的手段之一。</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#二-目前url重写最常见的两种方法有："><span class="nav-number">2.</span> <span class="nav-text">二.目前url重写最常见的两种方法有：</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#三、在请求管道中的第一个请求管道中拦截url并使其完成url重写功能："><span class="nav-number">3.</span> <span class="nav-text">三、在请求管道中的第一个请求管道中拦截url并使其完成url重写功能：</span></a></li></ol>
    
    </div>
  </aside>
</section>
        
      </div>
      <footer id="footer" class="site-footer">
  

  <div class="clearfix container">
      <div class="site-info">
	      &copy; 2018 haijd All Rights Reserved.
          
            <span id="busuanzi_container_site_uv">
              本站访客数<span id="busuanzi_value_site_uv"></span>人次  
              本站总访问量<span id="busuanzi_value_site_pv"></span>次
            </span>
          
      </div>
      <div class="site-credit">
        Theme by <a href="https://github.com/iTimeTraveler/hexo-theme-hiero" target="_blank">hiero</a>
      </div>
  </div>
</footer>


<!-- min height -->

<script>
    var contentdiv = document.getElementById("content");

    contentdiv.style.minHeight = document.body.offsetHeight - document.getElementById("allheader").offsetHeight - document.getElementById("footer").offsetHeight + "px";
</script>
    </div>
    <!-- <nav id="mobile-nav">
  
    <a href="/" class="mobile-nav-link">Home</a>
  
    <a href="/archives" class="mobile-nav-link">Archives</a>
  
    <a href="/categories" class="mobile-nav-link">Categories</a>
  
    <a href="/tags" class="mobile-nav-link">Tags</a>
  
    <a href="/about" class="mobile-nav-link">About</a>
  
</nav> -->
    

<!-- mathjax config similar to math.stackexchange -->

<script type="text/x-mathjax-config">
  MathJax.Hub.Config({
    tex2jax: {
      inlineMath: [ ['$','$'], ["\\(","\\)"] ],
      processEscapes: true
    }
  });
</script>

<script type="text/x-mathjax-config">
    MathJax.Hub.Config({
      tex2jax: {
        skipTags: ['script', 'noscript', 'style', 'textarea', 'pre', 'code']
      }
    });
</script>

<script type="text/x-mathjax-config">
    MathJax.Hub.Queue(function() {
        var all = MathJax.Hub.getAllJax(), i;
        for(i=0; i < all.length; i += 1) {
            all[i].SourceElement().parentNode.className += ' has-jax';
        }
    });
</script>

<script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML">
</script>


  <link rel="stylesheet" href="/fancybox/jquery.fancybox.css">
  <script src="/fancybox/jquery.fancybox.pack.js"></script>


<script src="/js/scripts.js"></script>
<script src="/js/bootstrap.js"></script>
<script src="/js/main.js"></script>








	<script async src="//dn-lbstatics.qbox.me/busuanzi/2.3/busuanzi.pure.mini.js">
	</script>






  </div>

  <a id="rocket" href="#top" class=""></a>
  <script type="text/javascript" src="/js/totop.js" async=""></script>
</body>
</html>
